package
{
  import mx.collections.ICollectionView;
  import mx.controls.treeClasses.ITreeDataDescriptor;

  public class BookmarkCollection implements ITreeDataDescriptor
  {

    public function getChildren(node:Object, model:Object=null):ICollectionView
    {
      var bookmark:Bookmark = node as Bookmark;
      return bookmark.children;
    }

    public function hasChildren(node:Object, model:Object=null):Boolean
    {
      var bookmark:Bookmark = node as Bookmark;
      return (bookmark.children && bookmark.children.length > 0);
    }

    public function isBranch(node:Object, model:Object=null):Boolean
    {
      var bookmark:Bookmark = node as Bookmark;
      return (bookmark.type == BookmarkType.FOLDER);
    }

    public function getData(node:Object, model:Object=null):Object
    {
      return node;
    }

    public function addChildAt(parent:Object, newChild:Object, index:int, model:Object=null):Boolean
    {
      return false;
    }

    public function removeChildAt(parent:Object, child:Object, index:int, model:Object=null):Boolean
    {
      return false;
    }

  }
}